<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>钟表练习</title>
    <style>
        @keyframes spin{
            0%{
                transform: rotate(0);
            }
            100%{
                transform: rotate(360deg);
                
            }
        }
        .spin{
            animation-name: spin;
            animation-timing-function: linear;
            
        }
        #panel{
            width: 600px;
            height: 600px;
            border: 1px solid black;
            margin: 0px auto;
            background-image: url("clock.jpg");
            /* background-size: 100% 100%; */
            background-position: 50% 50%;
            position: relative;
        }
        .point{
            position: absolute;
            animation-iteration-count: infinite;
        }
        #second-point{
            width: 4px;
            height: 250px;
            background-color: red;
            border-top-left-radius: 50%;
            border-top-right-radius: 50%;            
            left: 298px;
            top: 80px;
            animation-duration: 60s;
            transform-origin: 50% 88%;
            
        }

        #second-minute{
            width: 6px;
            height: 230px;
            background-color: blue;
            border-top-left-radius: 3px;
            border-top-right-radius: 3px;
            left: 297px;
            top: 99px;
            animation-duration: 3600s;
            transform-origin: 50% 88%;
        }
        #second-time{
            width: 8px;
            height: 190px;
            background-color: black;
            top: 130px;
            left: 296px;
            border-top-left-radius: 4px;
            border-top-right-radius: 4px;
           animation-duration: 43200s;
            transform-origin: 50% 89%;
        }
        #dot{
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: black;
            border: 4px solid red;
            position: absolute;
            left: 291px;
            top: 291px;
        }
    </style>
</head>
<body>
    <div id="panel">      
        
        <div id="second-time" class="spin point"></div>
        <div id="second-minute" class="spin point"></div>
        <div id="second-point" class="spin point"></div>
        <div id="dot"></div>

    </div>
    
    <script>
        var now = new Date();
        var h = now.getHours();
        var m = now.getMinutes();
        var s = now.getSeconds();
        var delay = h*60*60+m*60+s;
        var sp = document.getElementById("second-point");
        var mp = document.getElementById("second-minute");
        var hp = document.getElementById("second-time");
        sp.style.animationDelay=-delay+"s";
        mp.style.animationDelay = -delay + "s";
        hp.style.animationDelay = -delay+"s";
    </script>
</body>
</html>